{extend name="platform/base" /}
{block name="resources"}
<style>
.left-indent:before{
	content:'';
	display:inline-block;
	width:30%;
}
.right-indent:after{
	content:'';
	display:inline-block;
	width:20%;
}
.border-gray{border-color: #f1f1f1}
.border-solid{border-width:1px; border-style: solid;}
.gray{color: #999;}
</style>
<script type="text/javascript" src="__STATIC__/My97DatePicker/WdatePicker.js"></script>
{/block}


{block name="main"}

<div class="bg-white panel-body border-solid border-gray">
	<div class="col-sm-12">店铺信息</div>
	<div class="row panel-body">
		<div class="col-sm-2">店铺名称：{$shop_info['shop_name']}</div>
		<div class="col-sm-2">店铺等级：{$shop_info['type_name']}</div>
		{if condition="!empty($shop_info['shop_address'])"}
		<div class="col-sm-3">店铺地址：{$shop_info['address_area_name']} {$shop_info['shop_address']}</div>
		{/if}
		{if condition="!empty($shop_info['shop_qq'])"}
		<div class="col-sm-2">商家QQ：{$shop_info['shop_qq']}</div>
		{/if}
		{if condition="!empty($shop_info['live_store_tel'])"}
		<div class="col-sm-2">联系电话：{$shop_info['live_store_tel']}</div>
		{/if}
		{if condition="!empty($shop_info['shop_zip'])"}
		<div class="col-sm-2">邮编：{$shop_info['shop_zip']}</div>
		{/if}
		<div class="col-sm-2">店铺状态：
		{if condition="$shop_info['shop_state'] eq 0"}
			关闭
		{elseif condition = "$shop_info['shop_state'] eq 1"}
			开启
		{elseif condition = "$shop_info['shop_state'] eq 2"}
			审核中
		{/if}
		</div>
	</div>
	
	<div class="row b-t border-gray" style="margin-bottom: 12px;"></div>
	<div class="col-sm-12">账户信息</div>
	<div class="row panel-body">
		<div class="col-sm-2">总营业额：{php} echo sprintf("%.2f",$shop_account["shop_proceeds"] + $shop_account["wait_order_money"],2);{/php}</div>
		<div class="col-sm-2">待结算：{php} echo sprintf("%.2f",$shop_account["wait_order_money"] - $shop_account["wait_platform_order_money"],2);{/php}</div>
		<div class="col-sm-2">店铺余额：{$shop_account['shop_balance']}</div>
		<div class="col-sm-2">提现总额：{$shop_account['shop_withdraw']}</div>
		<!-- <div class="col-sm-2">发送总积分：{$shop_account['shop_point']}</div> -->
		<!-- <div class="col-sm-2">平台抽取利润：{$shop_account['shop_platform_commission']}</div> -->
	</div>
</div>

<div class="row padder-v">
	<div class="col-sm-7"></div>
	<div class="col-sm-2">
		<input type="text" id='startDate' placeholder="请选择开始日期" class="input-sm form-control" onclick="WdatePicker()"/>
	</div>
	<div class="col-sm-2">
		<input type="text" id='endDate' placeholder="请选择结束日期" class="input-sm form-control"  onclick="WdatePicker()" />
	</div>
	<!-- <div class="col-sm-2">
		<input type="text" id="search_text" class="input-sm form-control"
			placeholder="请输入店铺名称">
	</div> -->
	<div class="col-sm-1">
		<button class="btn btn-sm btn-default" type="button"
			onclick="LoadingInfo(1)">搜索</button>
	</div>
</div><section class="panel panel-default">
	<table class="table table-striped b-light text-sm">
		<colgroup>
				<col width="3%">
				<col width="15%">
				<col width="20%">
				<col width="15%">
				<col width="17%">
				<col width="10%">
				<col width="20%">
		</colgroup>
		<thead>
			<tr>
				<th><input type="checkbox"></th>
				<th class="left">流水号</th>
				<th class="left">标题</th>
				<th class="left">发生方式</th>
				<th class="left">备注</th>
				<th class="right">金额</th>
				<th class="center">创建时间</th>
			</tr>
		</thead>

		<tbody id="list">
			<tr></tr>
		</tbody>

	</table>
	<div class="padder-v b-t border-gray" style="padding-bottom: 30px;">
			<div class="col-sm-6"> </div>
			<div class="col-sm-2">已提现：<span class="gray" id="shop_cash"></span></div>
			<div class="col-sm-2">提现待审核：<span class="gray" id="shop_cash_isautit"></span></div>
			<div class="col-sm-2">营业额：<span class="gray" id="money"></span></div>
		</div>
	{include file="platform/page" /}
	<input type="hidden" id="shop_id" value="{$shop_id}">
</section>

{/block} {block name="script"}
<script type="text/javascript">
$(function(){
	LoadingInfo(1);
});

//查询用户列表
	function LoadingInfo(pageIndex) {
		var start_date = $("#startDate").val();
		var end_date = $("#endDate").val();
		var shop_id = $("#shop_id").val();
		//alert(status);
		$.ajax({
			type : "post",
			url : "{:__URL('PLATFORM_MAIN/shop/shopRecords')}",
			async : true,
			data : {
				"pageIndex" : pageIndex,"start_date":start_date,"end_date":end_date,"shop_id":shop_id},
			success : function(data) {
				console.log(data);
				// return;
				var html = '';
				$("#shop_cash").text(data.count.withdraw_cash.toFixed(2));
				$("#shop_cash_isautit").text(data.count.withdraw_isaudit.toFixed(2));
				$("#money").text(data.count.shop_order_money.toFixed(2));
				$("#money_isuse").text(data.count.shop_order_money_isuse); 
				$("#total_count_num").text(data["list"]["total_count"]);
				$("#page_count_num").text(data["list"]["page_count"]);
				$("#page_count").val(data["list"]["page_count"]);
				$("#pageNumber a").remove();
				if (data["list"]["data"].length > 0) {
					for (var i = 0; i < data["list"]["data"].length; i++) {
						html += '<tr>';
						html += '<td><input type="checkbox" name="sub" value="'+ data["list"]['data'][i]['shop_id']+'"></td>';
						html += '<td>' + data["list"]["data"][i]["serial_no"] + '</td>';
						html += '<td>' + data["list"]["data"][i]["title"] + '</td>';
						// switch(data["list"]["data"][i]["account_type"]){
						// 	case 1:
						// 	html += '<td class="left">订单支付</td>';
						// 	break;
						// 	case 2:
						// 	html += '<td class="left">商场提现</td>';
						// 	break;
						// 	case 3:
						// 	html += '<td class="left">申请招商员</td>';
						// 	break;
						// 	case 4:
						// 	html += '<td class="left">会员提现</td>';
						// 	break;
						// }
						if (data["list"]["data"][i]["account_type"] == '1'){
							html += '<td>订单</td>';
						}else if (data["list"]["data"][i]["account_type"] == '2'){
							html += '<td>提现</td>';
						}else{
							html += '<td></td>';
						}
						// if(data["list"]["data"][i]["account_type"] == 1){
						// html += '<td class="left">订单</td>';
						// }else{
						// 	html += '<td class="left">提现</td>';
						// }
						html += '<td class="left">' + data["list"]["data"][i]["remark"] + '</td>';
						html += '<td class="right">' + data["list"]["data"][i]["money"] + '</td>';
						
						html += '<td class="center">' + timeStampTurnTime(data["list"]["data"][i]["create_time"]) + '</td>';
						html += '</tr>';
					}
				} else {
					html += '<tr class="center"><td colspan="10">暂无账户明细记录</td></tr>';
				}
				$("#list").html(html);
					var totalpage = $("#page_count").val();
			if (totalpage == 1) {
				changeClass("all");
			}
			var $html = pagenumShow(jumpNumber,totalpage,{$pageshow})
			$("#pageNumber").append($html);
			}
		});
	}
	$("#search_text").keypress(function(e){
		if(e.keyCode == 13){
			LoadingInfo(1);
		}
	});
	
</script>
{/block}